# _*_ coding: UTF-8 _*_
# @Time     : 2021/10/25 上午 10:40
# @Author   : Li Jie
# @Site     : http://www.hzdledu.cn/
# @File     : c6s3_序列sequence.py
# @Software : PyCharm

# 序列的操作
# 1.序列的索引操作
list1 = [1, 2, 3]
tuple1 = (1, 2, 3)
print(list1[-1])
print(tuple1[-3])

list2 = [
    [1, 2, 3],
    [4, 5, 6],
    [7, 8, 9]
]
print(list2[0][2])
print(list2[1][2])
print(list2[2][2])

for i in list2:
    for j in i:
        print(j, end=',')
    print()

print('-----------------------------------')
# 2.序列的切片
list1 = [1, 2, 3, 4, 5, 6]
tuple1 = (1, 2, 3, 4, 5, 6)
print(list1[1:2])  # [2]
print(tuple1[:2])  # (1,2)
print(list1[1:])  # [2, 3, 4, 5, 6]
print(tuple1[::2])  # (1,3,5)

print('-----------------------------------')
# 3.序列相加
list1 = [1, 2, 3]
list2 = [4, 5, 6]
list3 = list1 + list2
print(list3)

# 4. 操作序列的函数
